/*
 * @Author: funlee
 * @Email: i@funlee.cn
 * @Date: 2018-01-12 01:28:11
 * @Last Modified time: 2018-01-12 01:28:11
 * @Description: 绘制扇形 
 */
window.onload = function () {
  var canvas = document.querySelector('.canvas')
  var cxt = canvas.getContext('2d')

  createSector(cxt, canvas.width / 2, canvas.height / 2, 50, 30, 120);
  cxt.fillStyle = "HotPink";
  cxt.fill();
}
function createSector(cxt, x, y, r, startAngle, endAngle) {
  cxt.beginPath();
  cxt.moveTo(x, y);
  cxt.arc(x, y, r, startAngle * Math.PI / 180, endAngle * Math.PI / 180, false);
  cxt.closePath();
}